#pragma once

#include <d3d9.h>
#include <d3dx9.h>
#pragma comment (lib,"d3d9.lib")
#pragma comment (lib,"d3dx9.lib")

struct D3DFEffect
{
	int          m_id;
	char*        m_path;
	LPD3DXEFFECT m_effect;
	D3DXHANDLE m_technique;

	D3DXHANDLE m_fxWorld;
	D3DXHANDLE m_fxView;
	D3DXHANDLE m_fxProj;
	D3DXHANDLE m_fxWorldVP;
	D3DXHANDLE m_fxWorldIT;
	D3DXHANDLE m_fxWorldI;
	D3DXHANDLE m_fxViewI;
	D3DXHANDLE m_fxCamPos;
	D3DXHANDLE m_fxLitPos;
	D3DXHANDLE m_fxLitWorld;
	D3DXHANDLE m_fxLitView;
	D3DXHANDLE m_fxLitAmbient;
	D3DXHANDLE m_fxLitSpecular;
	D3DXHANDLE m_fxMatAmbient;
	D3DXHANDLE m_fxMatDiffuse;
	D3DXHANDLE m_fxMatSpecular;
	D3DXHANDLE m_fxMatEmissive;
	D3DXHANDLE m_fxMatPower;
	D3DXHANDLE m_fxTexture2DA;
	D3DXHANDLE m_fxTexture2DB;
	D3DXHANDLE m_fxTexture2DC;
	D3DXHANDLE m_fxTexture2DD;
	D3DXHANDLE m_fxTexture2DE;
	D3DXHANDLE m_fxTexture2DF;
	D3DXHANDLE m_fxTexture3DA;
	D3DXHANDLE m_fxTexture3DB;
	D3DXHANDLE m_fxTexture3DC;
	D3DXHANDLE m_fxTexture3DD;
	D3DXHANDLE m_fxTexture3DE;
	D3DXHANDLE m_fxTexture3DF;
	D3DXHANDLE m_fxWinWidth;
	D3DXHANDLE m_fxWinHeight;

	void init()
	{
		m_effect->FindNextValidTechnique(0,&m_technique);
		m_fxView        = m_effect->GetParameterBySemantic(0,"VIEW");
		m_fxProj        = m_effect->GetParameterBySemantic(0,"PROJ");
		m_fxWorld       = m_effect->GetParameterBySemantic(0,"WORLD");
		m_fxWorldVP     = m_effect->GetParameterBySemantic(0,"WORLDVP");
		m_fxWorldIT     = m_effect->GetParameterBySemantic(0,"WORLDIT");
		m_fxWorldI      = m_effect->GetParameterBySemantic(0,"WORLDI");
		m_fxViewI       = m_effect->GetParameterBySemantic(0,"VIEWI");
		m_fxCamPos      = m_effect->GetParameterBySemantic(0,"CAMPOS");
		m_fxLitPos      = m_effect->GetParameterBySemantic(0,"LITPOS");
		m_fxLitWorld    = m_effect->GetParameterBySemantic(0,"LITWORLD");
		m_fxLitView     = m_effect->GetParameterBySemantic(0,"LITVIEW");
		m_fxLitAmbient  = m_effect->GetParameterBySemantic(0,"LITAMBIENT");
		m_fxLitSpecular = m_effect->GetParameterBySemantic(0,"LITSPECULAR");
		m_fxMatAmbient  = m_effect->GetParameterBySemantic(0,"MATAMBIENT");
		m_fxMatDiffuse  = m_effect->GetParameterBySemantic(0,"MATDIFFUSE");
		m_fxMatSpecular = m_effect->GetParameterBySemantic(0,"MATSPECULAR");
		m_fxMatEmissive = m_effect->GetParameterBySemantic(0,"MATEMISSIVE");
		m_fxMatPower    = m_effect->GetParameterBySemantic(0,"MATPOWER");
		m_fxTexture2DA  = m_effect->GetParameterBySemantic(0,"TEXTURE2DA");
		m_fxTexture2DB  = m_effect->GetParameterBySemantic(0,"TEXTURE2DB");
		m_fxTexture2DC  = m_effect->GetParameterBySemantic(0,"TEXTURE2DC");
		m_fxTexture2DD  = m_effect->GetParameterBySemantic(0,"TEXTURE2DD");
		m_fxTexture2DE  = m_effect->GetParameterBySemantic(0,"TEXTURE2DE");
		m_fxTexture2DF  = m_effect->GetParameterBySemantic(0,"TEXTURE2DF");
		m_fxTexture3DA  = m_effect->GetParameterBySemantic(0,"TEXTURE3DA");
		m_fxTexture3DB  = m_effect->GetParameterBySemantic(0,"TEXTURE3DB");
		m_fxTexture3DC  = m_effect->GetParameterBySemantic(0,"TEXTURE3DC");
		m_fxTexture3DD  = m_effect->GetParameterBySemantic(0,"TEXTURE3DD");
		m_fxTexture3DE  = m_effect->GetParameterBySemantic(0,"TEXTURE3DE");
		m_fxTexture3DF  = m_effect->GetParameterBySemantic(0,"TEXTURE3DF");
		m_fxWinWidth    = m_effect->GetParameterBySemantic(0,"WINWIDTH");
		m_fxWinHeight   = m_effect->GetParameterBySemantic(0,"WINHEIGHT");
	}
};